<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../ucs.css">
    <link rel="stylesheet" href="../font/iconfont.css">
    <link rel="stylesheet" href="../demo.css">
</head>
<body>
    <div id="main"></div>
    <script type="text/javascript" src="../../dist/libs/u-eventhub.js"></script>
    <script type="text/javascript" src="../../dist/libs/engine.js"></script>
    <script type="text/javascript" src="../../dist/ucsmy-ui.js"></script>

    <script type="text/javascript">
        //个人实名信息
        var realNameInfoDM = new UDM({
            value:{
                AccType:1,
                Mobile:"",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../demoUserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../demoUserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../demoMyBankCard/index.html",//绑卡链接
                Current:"FinanceList",  //当前选中菜单
                InvestAccountUrl:"../demoMyAccount11/index.html",//投资账户总览链接
                InvestListUrl:"../demoMyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../demoMyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../demoUserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../demoUserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../demoFinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../demoFinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../demoAccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../demoCompanyMessageCenter/index.html"//融资消息中心
            }
        })
        //分页条模型
        var paginationDM = new UDM({
            value: {	//默认值为0
                totalPage: "2017-03-20",	//总页数
                pageSize: 4,	//每页显示条数
                curPage: 1	//当前页码
            },
            onClick:function(){
                ajaxFn();
            }
        });

        //筛选条件模型
        var datePickerSearchDM = new UDM({
            value: {
                startTime:'',
                endTime:'',
                label:'投资时间：',
                connect:'至'
            },
            onChange:function (start,end) {
                console.log(start+end)
            }
        })
        var StautsOptionDM = new UDM({
            value:[
                {
                    option: "审核中",
                    value: "1"
                },
                {
                    option: "申请失败",
                    value: "2"
                },{
                    option: "预售中",
                        value: "3"
                },
                {
                    option: "已还款",
                        value: "4"
                }
            ],
            selected:'所有项目',
            onChange: function () {
                //执行ajax请求
                console.log(StautsOptionDM.selected);
            }
        })

        //融资记录模型
        var investRecordDM = new UDM({
            value:[
                {
                    ProjectName:  "商票理财【20160002】",//项目名
                    ProjectType:  "6.30",	//项目类型（0普通项目，1专属项目）
                    Amount:  "98101000.00",	//融资规模
                    FinanceRate:"8.35",	//融资利率
                    Duration: "21",	//融资期限
                    F_Status: "3",	//融资项目状态还款中=1, 还款完成=2,  融资完成=3,投标中 = 4,预热中 = 5,项目流标 = 6,
                    F_Text:"融资完成",
                    Progress: "100",	//融资进度
                    RepayBegin: "2017-03-20" //还款日期

                }
            ]
        })

        //模拟后台返回数据
        var listValue = [
            {
                ProjectUrl:"../demoFinanceInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名
                ProjectType:  "6.30",	//项目类型（0普通项目，1专属项目）
                Amount:  "98101000.00",	//融资规模
                FinanceRate:"8.35",	//融资利率
                Duration: "21",	//融资期限
                F_Status: "3",	//融资项目状态还款中=1, 还款完成=2,  融资完成=3,投标中 = 4,预热中 = 5,项目流标 = 6,
                F_Text:"已还款",
                Progress: "100",	//融资进度
                RepayBegin: "2017-03-20" //还款日期

            },{
                ProjectUrl:"../demoFinanceInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名
                ProjectType:  "6.30",	//项目类型（0普通项目，1专属项目）
                Amount:  "98101000.00",	//融资规模
                FinanceRate:"8.35",	//融资利率
                Duration: "21",	//融资期限
                F_Status: "1",	//融资项目状态还款中=1, 还款完成=2,  融资完成=3,投标中 = 4,预热中 = 5,项目流标 = 6,
                F_Text:"已还款",
                Progress: "10",	//融资进度
                RepayBegin: "2017-03-20" //还款日期

            },{
                ProjectUrl:"../demoFinanceInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名
                ProjectType:  "6.30",	//项目类型（0普通项目，1专属项目）
                Amount:  "98101000.00",	//融资规模
                FinanceRate:"8.35",	//融资利率
                Duration: "21",	//融资期限
                F_Status: "4",	//融资项目状态还款中=1, 还款完成=2,  融资完成=3,投标中 = 4,预热中 = 5,项目流标 = 6,
                F_Text:"预售中",
                Progress: "40",	//融资进度
                RepayBegin: "2017-03-20" //还款日期

            },{
                ProjectUrl:"../demoFinanceInvestDetail/index.html", //项目详情链接
                ProjectName:  "商票理财【20160002】",//项目名
                ProjectType:  "6.30",	//项目类型（0普通项目，1专属项目）
                Amount:  "98101000.00",	//融资规模
                FinanceRate:"8.35",	//融资利率
                Duration: "21",	//融资期限
                F_Status: "6",	//融资项目状态还款中=1, 还款完成=2,  融资完成=3,投标中 = 4,预热中 = 5,项目流标 = 6,
                F_Text:"审核中",
                Progress: "80",	//融资进度
                RepayBegin: "2017-03-20" //还款日期

            }
        ];
        var ajaxFn = function () {
            var pageSize = paginationDM.getValue().pageSize;	//获取每页显示条数
            var curPage = paginationDM.getValue().curPage;		//获取当前选中页码
            

            var curListValue = [];

            var paginationValue = {
                totalPage: Math.ceil(listValue.length/pageSize),	//总页数
                pageSize: pageSize,	//每页显示条数
                curPage: curPage	//当前页码
            }

            if(listValue.length>0){
                for(var i = curPage*pageSize - pageSize ; i < curPage*pageSize ; i ++){
                    if(listValue[i]){
                        curListValue.push(listValue[i]);
                    }
                }
            }
            /*个人实名信息*/
            var realName = {
                AccType:1,
                Mobile:"155****2132",
                IsBindMobile:true,//是否绑定手机
                BindMobileUrl:"../demoUserInfo/index.html",//绑定手机链接
                IsBindIDCard:false,//是否验证身份
                BindIDCardUrl:"../demoUserInfo/index.html",//验证身份链接
                IsBindBankCard:false,//是否绑卡
                BindBankCardUrl:"../demoMyBankCard/index.html",//绑卡链接
                Current:"FinanceList",  //当前选中菜单
                InvestAccountUrl:"../demoMyAccount/index.html",//投资账户总览链接
                InvestListUrl:"../demoMyInvest/index.html",//投资记录链接
                MyBankCardUrl:"../demoMyBankCard/index.html",//我的银行卡链接
                InvestInfoUrl:"../demoUserInfo/index.html",//投资个人信息
                InvestMessageUrl:"../demoUserMessageCenter/index.html",//投资消息中心
                FinanceAccountUrl:"../demoFinanceAccount/index.html",//融资账户总览链接
                FinanceListUrl:"../demoFinanceList/index.html",//融资记录链接
                FinanceAccountInfoUrl:"../demoAccountInfo/index.html",//融资账号信息
                FinanceMessageUrl:"../demoCompanyMessageCenter/index.html"//融资消息中心
            };

            realNameInfoDM.setValue(realName);
            paginationDM.setValue(paginationValue);
            investRecordDM.setValue(curListValue);
        }
        var PageDM = {
            pagination: paginationDM,
            investRecord: investRecordDM,
            datePickerSearch: datePickerSearchDM,
            stautsOption: StautsOptionDM,
            realNameInfo: realNameInfoDM
        }
        UEventHub.on('pageLoad', function(v){
            ajaxFn();
            console.log(v);
            UEventHub.emit("test","你好，","世界！");
        });
    </script>
<script type="text/javascript" src="../demoFinanceList\index.js"></script></body>
</html>